package com.study.runner;

import com.study.netty.client.BootNettyTcpClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@Order(2)
public class NettyTwoTcpClientCommandLineRunner implements CommandLineRunner {
    @Value("${gps.netty.tcp.server}")
    String serverIp;
    @Value("${gps.netty.tcp.port}")
    int port;

    @Async
    @Override
    public void run(String... args) throws Exception {
        log.info("start tcp client ");
        new BootNettyTcpClient().connect(port, serverIp);
    }
}
